//
//  LoadPopView.m
//  socketDemo
//
//  Created by kingboyrang on 2020/8/10.
//  Copyright © 2020 kingboyrang. All rights reserved.
//

#import "LoadPopView.h"

@implementation LoadPopView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

+ (LoadPopView *)loadXibView{
    
    UINib *nib = [UINib nibWithNibName:@"LoadPopView" bundle:nil];
       LoadPopView *view = [nib instantiateWithOwner:nil options:nil].firstObject;
    view.frame = CGRectMake(0, 0, 300, 253);
       view.layer.cornerRadius = 10;
       view.layer.masksToBounds = YES;
    view.layer.borderWidth = 1.0;
    view.layer.borderColor = [UIColor colorWithRed:255/255.0 green:149/255.0 blue:0 alpha:1.0].CGColor;
    view.labSendStatus.text = @"";
       view.labCloseStatus.text = @"";
    return view;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.labSendStatus.text = @"";
    self.labCloseStatus.text = @"";
}

- (void)resetLabel{
    self.labConnectStatus.text = @"连接中...";
    self.labSendStatus.text = @"";
    self.labCloseStatus.text = @"";
}


- (void)showInView:(UIView *)innerView{
    self.alpha=0;
    [innerView addSubview:self];
    self.transform=CGAffineTransformMakeScale(0.02, 0.02);

    CGRect r = self.frame;
    r.origin.x = (innerView.frame.size.width - self.frame.size.width)/2.0;
    r.origin.y = (innerView.frame.size.height - self.frame.size.height)/2.0;
    self.frame=r;
    [UIView animateWithDuration:0.4f animations:^{
       self.transform=CGAffineTransformMakeScale(1.0, 1.0);
       self.alpha=1;
       
    }];


}

- (void)dismiss{
    self.transform=CGAffineTransformMakeScale(1.0, 1.0);
       self.alpha=1;
       [UIView animateWithDuration:0.4f animations:^{
          self.transform=CGAffineTransformMakeScale(0.02, 0.02);
          self.alpha=0;
          [self removeFromSuperview];
       }];
}


@end
